package com.stp.event.service.impl;

import com.stp.event.service.PayService;
import lombok.Setter;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class PayStrategyContext {
    private final Map<String, PayService> strategyServiceMap = new ConcurrentHashMap<>();

    public PayStrategyContext(Map<String, PayService> strategyMap) {
        this.strategyServiceMap.clear();
        this.strategyServiceMap.putAll(strategyMap);
    }

    public PayService getResource(String payType) {
        return strategyServiceMap.get(payType);
    }
}
